package com.example.workflow.gateway;

import lombok.extern.slf4j.Slf4j;
import org.camunda.bpm.client.spring.annotation.ExternalTaskSubscription;
import org.camunda.bpm.client.task.ExternalTaskHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 侯宁 on 2024/5/4
 */
@Slf4j
@Configuration
public class VideoCheckExterTaskService {

    @Bean
    @ExternalTaskSubscription(topicName = "checkNegtive", processDefinitionKeyIn =
            {"Process_parallel_gateway", "Process_embedded_subprocess"})
    public ExternalTaskHandler checkVideoNegtive() {
        return (externalTask, externalTaskService) -> {
            log.info("进入检查视频是否负面");
            Object videoName = externalTask.getVariable("videoName");
            log.info("视频名称: {} 不包含负面内容", videoName);
            externalTaskService.complete(externalTask);
        };
    }
}
